package cn.e4j.modular.system.service.impl;

import cn.e4j.core.dto.impl.Dto;
import cn.e4j.modular.system.entity.SysCmp;
import cn.e4j.modular.system.entity.SysModule;
import cn.e4j.modular.system.mapper.SysCmpMapper;
import cn.e4j.modular.system.service.SysCmpService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 界面组件表 服务实现类
 * </p>
 *
 * @author wenchuan.li
 * @since 2018-12-13
 */
@Service
public class SysCmpServiceImpl extends ServiceImpl<SysCmpMapper, SysCmp> implements SysCmpService {

    @Transactional(readOnly = true)
    public List<Map<String, Object>> getCmplist(Page<Object> page, Dto dto) {

        List<Map<String, Object>> cmpDtos = this.baseMapper.listCmpPage(page, dto);

        return cmpDtos;
    }

    @Transactional(readOnly = true)
    public List<SysCmp> getCmplist(Dto dto) {

        List<SysCmp> cmpDtos = this.baseMapper.listCmpExports(dto);
        return cmpDtos;
    }

    @Transactional(readOnly = true)
    public SysModule selectModuleByKey(String pageId) {

        SysModule sysModule = this.baseMapper.selectModuleByKey(pageId);
        return sysModule;
    }
}
